package com.company.cloud.club.modules.vo;

import com.company.cloud.club.modules.core.util.ValidateUtil;
import com.company.cloud.club.modules.dto.product.ProductBo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Data
public class RecommendCardVo implements Serializable {

    private String id;

    private String avatar;

    private String nickname;

    private String label;

    private String title;

    private String type;

    private String fileType;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String content;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String shortContent;

    private Integer praiseNum;

    private Integer commentNum;

    private Integer collectionNum;

    private String parentId;

    private Integer userId;

    private BigDecimal price;

    private String ctime;

    private Boolean isPraise;

    private Boolean isAuthor;

    private Boolean isEssence;

    private ClubMemberVo parentMemberVo;

    private RecommendCardVo parentRecommendVo;

    private Boolean isColled;                                           // 是否被收藏

    private Boolean isColledAuthor;                                     // 是否关注此作者

    private Boolean isSug;                                              // 是否推荐

    private String clubId;                                              // 所属社圈ID

    private ProductBo product;                                          // 关联的商品

    private ClubVo club;                                                // 所属社圈

    private ActivityVo activity;                                        // 所属活动

    private List<String> imgUrls = new ArrayList<>();                   // 图片地址

    private List<RecommendCardVo> children = new ArrayList<>();         // 子评论

    private List<RecommendCardVo> relativeReco = new ArrayList<>();     // 相关推荐

    private Boolean isForbidden = false;                                // 用户是否被禁言

    public void addImg(String img) {
        if (ValidateUtil.isValid(img)) {
            this.imgUrls.add(img);
        }
    }

    public void addChildren(RecommendCardVo card) {
        if (card != null) {
            this.children.add(card);
        }
    }

    public void addRelative(RecommendCardVo card) {
        if (card != null) {
            this.relativeReco.add(card);
        }
    }

}
